package cn.com.io.stream;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * Created by Administrator on 2015/12/9.
 */
public class FileInputStreamTest {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream(new File(System.getProperty("user.dir")+"\\src\\cn\\com\\io\\stream\\FileInputStreamTest.java"));//创建字节输入流
        byte[] buf = new byte[1024];//创建一个长度为1024的数组，用来存储读取到的数据
        int hasRead = 0;//用于保存实际读取到的字节数
        while((hasRead = fis.read(buf))> 0){
            System.out.println(new String(buf,0,hasRead));
        }
        fis.close();
    }
}
